import infiniteSites as infs
import summaryStats as ss
import msTools as ms
import TajimasD as td

#data = [[1,0,0,0,0,0,1,0],
#        [0,0,1,1,0,0,1,0],
#        [0,1,1,0,0,0,1,0],
#        [0,0,0,0,0,1,1,0],
#        [0,0,0,0,1,0,0,1]]

p = ms.readMS( 'msOuts/out10_1.ms' )
data = p[0].table
print data
print

SFS = infs.getSiteFrequencySpectrum(data)
print SFS
print

t = td.TajimasD()

print t.calculateNumerator(SFS)


n = 10
#linOpSS = ss.getSegregatingSitesOperator(n)
#linOpS  = ss.getSingletonsOperator(n)
#linOpPi = ss.getHeterozygosityOperator(n)
#
SFS = infs.getSiteFrequencySpectrum( data )
#print SFS
#print
#
#print 'SS'
#print ss.segregatingSites(SFS)
#print ss.operationOn(linOpSS, SFS)
#print
#
#print 'S'
#print ss.singletons(SFS)
#print ss.operationOn(linOpS, SFS)
#print
#
#print 'Pi'
#print ss.heterozygosity(SFS)
#print ss.operationOn(linOpPi, SFS)
#print
#
#print ss.operationOn( ss.getTheta_Pi(n), SFS )
#print ss.operationOn( ss.getTheta_SS(n), SFS )
#print ss.operationOn( ss.getTheta_S(n), SFS )
#
TajimasD = ss.getTajimasDLinearOperator(n)
#print TajimasD
print ss.operationOn(TajimasD, SFS)
#
#FuLiD = ss.getFuLiDLinearOperator(n)
#print FuLiD
#print ss.operationOn(FuLiD, SFS)
#
#FuLiF = ss.getFuLiFLinearOperator(n)
#print FuLiF
#print ss.operationOn(FuLiF, SFS)

#p = ms.readMS( 'out1.ms' )
#for itr in p:
#    print itr
#    print '\n'